package com.stujyh.spring6;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class Test {
    public static void main(String[] args) {
        OrderDao target = new OrderService();
        //创建动态代理对象
        OrderDao objProxy =(OrderDao) Proxy.newProxyInstance(target.getClass().getClassLoader(),
                target.getClass().getInterfaces(),
                new TimerInvocationHandler(target));
        objProxy.addOrder();
        objProxy.deleteOrder();
        objProxy.detailOrder();
    }
}
